How to install Docker in Ubuntu 20.04

What is Docker?

Docker is a system that allows you to encapsulate applications within conainers, similar to virtual machines but more manageable, flexible and transportable. These containers have all the information necessary to run the applications they contain isolated (services, configurations, applications, data, etc …). Thus it is possible to migrate these containers from one server to another quickly and easily, without having to adapt the servers where they are executed in a specific way.

Previous Requisites

In order to carry out the actions described in this article we will need to have:

Installing Docker

Probably the official Ubuntu package repository does not have the last version of Docker.

That’s why we are going to install it from Docker’s official repository. We add this repository to our system:

sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt-get update

Once completed we proceed to install the last available version of Docker, and then we will add our user to the docker group so we can execute it without sudo. We will have to login again with our password for actions to take effect:

sudo apt-get install docker-ce
sudo usermod -aG docker ${USER}
su - ${USER}

At last we will check that Docker was installed correctly and that it is working in our system:

docker --version

Entradas relacionadas